
<meta charset="utf-8">
<div class="box" id="biz_pmpDifScore_conatainer">
	<div class="box-body">
		<div class="row">
			<div class="col-md-12">
				<div class="btn-group " id="pmpDifScoreTableToolbar" role="group">
					<button type="button" v-kperms="{perm:''}" class="btn btn-default" v-on:click="add">
						<i class="glyphicon glyphicon-plus" aria-hidden="true"></i> 添加
					</button>
					<button type="button" v-kperms="{perm:''}" class="btn btn-default" v-on:click="edit">
						<i class="glyphicon glyphicon-pencil" aria-hidden="true"></i>修改
					</button>
					<button type="button" v-kperms="{perm:''}" class="btn btn-default" v-on:click="deletex">
						<i class="glyphicon glyphicon-trash" aria-hidden="true"></i> 删除
					</button>
				</div>
				<table id="pmpDifScoreBootstrapTable" data-mobile-responsive="true"></table>
			</div>
		</div>
	</div>
</div>
<script>

new Vue({  
	  el: '#biz_pmpDifScore_conatainer',
	  data:{
		  bus:new Vue(),
	  },
	  mounted:function(){
		  var _this=this;
		  _this.initTable();
	  },
    methods: {
  	  initTable:function(){
  		var _this=this;
 
  		var columns=[{checkbox:true,width:20},
  					{field:'name',title:'难度名称',width:160},
  					{field:'score',title:'难度分数',width:160},
  					{field:'status',title:'状态',width:100,formatter:_this.formatStatus}];
  		  var url="/pmp/service/pub/pmpALine/loadDifScoreDataSet";
    		zfesBstable.laodTable($("#pmpDifScoreBootstrapTable"),$("#searchForm"),$("#pmpDifScoreTableToolbar"),url,columns,{"cloudGroupId":null});
  	  },
  	  search:function(){
  		  zfesBstable.reload($("#pmpDifScoreBootstrapTable")); 
  	  },
  	  refresh:function(){
  		  zfesBstable.refresh($("#pmpDifScoreBootstrapTable"));
  	  },
  	  add:function(){
  	    var　_this=this;
		var url="/views/pmpDifScore/pmpDifScore.add.html";
		zfesLayerEditDg.open(url,{},"添加难度",460,function(){_this.refresh();}); 
		 
  	},
  	  edit:function(){
  		  if(zfesBstable.isOneRow($("#pmpDifScoreBootstrapTable"))){
  			  var　_this=this;
  			  var id=zfesBstable.getRowId($("#pmpDifScoreBootstrapTable"));
  			  var url="/views/pmpDifScore/pmpDifScore.edit.html";
  			  zfesLayerEditDg.open(url,{"id":id},"修改难度",460,function(){_this.refresh();}); 
  		 }
  	  },
  	  deletex:function(){
  			if(zfesBstable.isSelectedRow($("#pmpDifScoreBootstrapTable"))){
  				  var　_this=this;
  				    var id=zfesBstable.getRowId($("#pmpDifScoreBootstrapTable"));
  					 alertSwal.confirm("删除","是否删除该数据",function(){
  						    var ajaxUrl = "/pmp/service/ma/difScore/setDifScoreStatus";
  							zfesAjax.ajaxTodo(ajaxUrl, { "id" : id,"status":-1}, function(data) {
  								alertSwal.successText(data.message);
  								_this.refresh();
  							}); 
  				});
  			}
  				
  	  },
  	  formatStatus: function(value, row, index){//状态_D#1正常，-1删除 #
    		if("1"==value||1==value){
    			return '<span class="label label-success">正常</span>';
    		}else if("-1"==value||-1==value){
    			return '<span class="label label-danger">删除</span>';
    		}
    	},
  	  
   }

});
</script>


